{% extends "../master.html" %}

{% block header %}
    {% include "../header.html" %}
{% endblock %}

{% block page %}
    <h1>Yams</h1>
    <h3>Player:</h3>
    <div class="player">
        <form class="form" action="/yams/player" method="post">
        <div class="button">
            <input name="player_name" value="" type="text" />
            <br />
            <br />
            <input name="cancel" value="Cancel" type="submit" /> |
            <input name="create_game" value="Create game" type="submit" /> |
            <input name="choose_game" value="Choose game" type="submit" />
            <input name="size_key" value="{{ size.key }}" type="hidden" />
            <input name="language_key" value="{{ language.key }}" type="hidden" />
        </div>
        </form>
    </div>

    <h3>Existing players:</h3>
    <table>
        {% for player in players %}
        <tr>
            <td>
                - {{ player.name }}
            </td>
            <td>
                <form class="form" action="/yams/show_game" method="post">
                <div class="button">
                    | <input name="show" value="Show game" type="submit" />
                    <input name="player_key" value="{{ player.key }}" type="hidden" />
                    <input name="size_key" value="{{ size.key }}" type="hidden" />
                    <input name="language_key" value="{{ language.key }}" type="hidden" />
                </div>
                </form>
            </td>
            {% if admin %}
            <td>
                <form class="form" action="/yams/admin/delete_player" method="post">
                <div class="button">
                    | <input name="delete" value="Delete" type="submit" />
                    <input name="player_key" value="{{ player.key }}" type="hidden" />
                    <input name="size_key" value="{{ size.key }}" type="hidden" />
                    <input name="language_key" value="{{ language.key }}" type="hidden" />
                </div>
                </form>
            </td>
            {% endif %}
        </tr>
        {% endfor %}
    </table>

    <h3>Existing games:</h3>
    <table>
        {% for game in games %}
        <tr>
            <td>
                - {{ game.name }}
            </td>
            <td>
                <form class="form" action="/yams/show_game" method="post">
                <div class="button">
                    | <input name="show" value="Show game" type="submit" />
                    <input name="game_key" value="{{ game.key }}" type="hidden" />
                    <input name="size_key" value="{{ size.key }}" type="hidden" />
                    <input name="language_key" value="{{ language.key }}" type="hidden" />
                </div>
                </form>
            </td>
            {% if admin %}
            <td>
                <form class="form" action="/yams/admin/delete_game" method="post">
                <div class="button">
                    | <input name="delete" value="Delete" type="submit" />
                    <input name="game_key" value="{{ game.key }}" type="hidden" />
                    <input name="size_key" value="{{ size.key }}" type="hidden" />
                    <input name="language_key" value="{{ language.key }}" type="hidden" />
                </div>
                </form>
            </td>
            {% endif %}
        </tr>
        {% endfor %}
    </table>
{% endblock %}

{% block footer %}
    {% include "../footer.html" %}
{% endblock %}
